
from openpyxl import Workbook,load_workbook





if __name__ == "__main__":



    #读取文件
    wb1 = load_workbook("handprocess.xlsx",read_only=True)
    wv1 = wb1.active
    #遍历每一个单元格
    shadow_id_list = []
    for row in wv1.rows:
        s = row[0].value
        #获取单元格值

        if s is None:
            continue

        shadow_id = ''
        #遍历这个字符串
        for ch in s:
            # 跳过空白字符
            if ch.isspace():
                continue

            shadow_id += ch

            #终止确认符号 
            if ch == "S" and len(shadow_id)== 11:

                shadow_id_list.append(shadow_id)
                shadow_id = ''

    wb2 = Workbook()
    wv2 = wb2.active

    for s_id in shadow_id_list:
        wv2.append([s_id])

    wb2.save("handprocess_c.xlsx")

    print("处理完成")




    #写进一个新的文件